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

Query time 0.00025