UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TJYOHX8cVM8kZFC3Cwn9lwxaDE0ab9vkoI2T8QPmAU0=' 
WHERE 
  key_id = 'fb1f0d6dc40a4ab22eb647072d31557c1d698fcf33f7259b180d13167839b9de' 
  AND (
    token = 'TJYOHX8cVM8kZFC3Cwn9lwxaDE0ab9vkoI2T8QPmAU0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030