UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'a843yqHPaNVcUIKu0yoC0iFPXklymxxUPteVJDxaKO4=' 
WHERE 
  key_id = '624dbba247ef1662e54247eac55e3cb7e8ecd1c0d27a6e36dd12550526815778' 
  AND (
    token = 'a843yqHPaNVcUIKu0yoC0iFPXklymxxUPteVJDxaKO4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028