UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Io/g1o0yox7Nc1WC8OMXBaEmLUpagi9uMOaI3sdq0IE=' 
WHERE 
  key_id = '893c577bd21450a0ea62a613766a914d6d8f55dfdc3a740d81ccc15e1ef2f301' 
  AND (
    token = 'Io/g1o0yox7Nc1WC8OMXBaEmLUpagi9uMOaI3sdq0IE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053