UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GEBQyP22uRLqEB70eyqm8mnXwRfrIXUYEM4uZByG+Ow=' 
WHERE 
  key_id = '6637a55a62506882337a9e282e8714ee3867668f6e6b495e8cc74f9a5392bf57' 
  AND (
    token = 'GEBQyP22uRLqEB70eyqm8mnXwRfrIXUYEM4uZByG+Ow=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034