UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KMyIvoTMzaxE9XeqpFRWUYAgCrvAh8cRH5WEgyeLKEQ=' 
WHERE 
  key_id = 'c6f07da111a2e02cab1e9b4622e6488b80dacb5fb2d4d2d8990ef498fc55336b' 
  AND (
    token = 'KMyIvoTMzaxE9XeqpFRWUYAgCrvAh8cRH5WEgyeLKEQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026