UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VQG8j7wyybSwJdiX/81TwlF6GBKUoAZpesmWdsclSes=' 
WHERE 
  key_id = 'd02261265b7eec7f4792458c19d3d0c1885ba05ec6d15bd973e522680b2b2529' 
  AND (
    token = 'VQG8j7wyybSwJdiX/81TwlF6GBKUoAZpesmWdsclSes=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039