UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gzUhtIPOVyAJzJgXk5eKKRc6GamFlCehnbzsm0HBNZA=' 
WHERE 
  key_id = '418df0356bfea99fb80c692a0dab2c3e4f4872d504f9fc961756006bcdde8b85' 
  AND (
    token = 'gzUhtIPOVyAJzJgXk5eKKRc6GamFlCehnbzsm0HBNZA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020