UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yTkGf9HBqT6Le19m1dUyKtejt6O3pEtFTFxEDmk50Es=' 
WHERE 
  key_id = '998d7c6596e97dc892902db9e58b4cc00fc1dcae838c8726fa5653dc82553df7' 
  AND (
    token = 'yTkGf9HBqT6Le19m1dUyKtejt6O3pEtFTFxEDmk50Es=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038