UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PKKK8sf2VxHB204oxg9WcFHMObZ1+eYNglE7LiOoBZQ=' 
WHERE 
  key_id = '269fd09df3a16ba8242ae866a76c7834e3e5ab818a429a89842d2b11be23939c' 
  AND (
    token = 'PKKK8sf2VxHB204oxg9WcFHMObZ1+eYNglE7LiOoBZQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051