UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ta9Og8AQzMJtcgPxLdypY78BsmpKgOUxmXZCv+pLCZs=' 
WHERE 
  key_id = 'cd49d4b0374700d840dc1c0236af6f3d041bb6cbe6ad62ae7be9729dd5a6907a' 
  AND (
    token = 'Ta9Og8AQzMJtcgPxLdypY78BsmpKgOUxmXZCv+pLCZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045