UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E5NFJ8ic6uSczcmT9uDPFtYOyfiMhWr7gOuSSywg3EE=' 
WHERE 
  key_id = '9954e3dc3654c093a79ff2b769da3e677a3b43413391d59da15698c3d3571323' 
  AND (
    token = 'E5NFJ8ic6uSczcmT9uDPFtYOyfiMhWr7gOuSSywg3EE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032