UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LqhcCZP9YTzZ6cYaAgd9prXQ2q573CB1RsAEgwPrpIM=' 
WHERE 
  key_id = '45611efe8ab3a426385b270692591194232e91db4d6bed67093b2cbd6fae5c00' 
  AND (
    token = 'LqhcCZP9YTzZ6cYaAgd9prXQ2q573CB1RsAEgwPrpIM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051