UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fEmWaAlrU3JndQxbot4ZlB+9ELsKmC/DNMjjUOL7s20=' 
WHERE 
  key_id = '7031298957a92f6406a697713625bc13c5bb049b974b85d5ab5c9b33590022b5' 
  AND (
    token = 'fEmWaAlrU3JndQxbot4ZlB+9ELsKmC/DNMjjUOL7s20=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040