UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8zqQCaq0y3HrXu88J3YgGV9vWowcMrKqMrughITnT3g=' 
WHERE 
  key_id = '615892eea3aa3e40903b5152eac808014abf3e71495b4ca1408764f08ac18e82' 
  AND (
    token = '8zqQCaq0y3HrXu88J3YgGV9vWowcMrKqMrughITnT3g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028