UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'RTysO2L4OTRyErRxr0I2r+hB+QfNFO+Mv/d+quKzXrc=' 
WHERE 
  key_id = '8655b845e7b5b4968bc4ccb37f638b0955e18331c7c761bd39b0700d5bc7621c' 
  AND (
    token = 'RTysO2L4OTRyErRxr0I2r+hB+QfNFO+Mv/d+quKzXrc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026