UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'P2TqQUJ2hrrT8IFL06QA1Ove96awUp76d8u+5U9sU5g=' 
WHERE 
  key_id = '87c182bbd12fdfc2d1fddb47d3f17be2bb5ca397c840c13c90edc48c67ba7f82' 
  AND (
    token = 'P2TqQUJ2hrrT8IFL06QA1Ove96awUp76d8u+5U9sU5g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045