UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '65kcELjde/agLWH0kB5at3LrfMVw/80GWP5RIJtRlEs=' 
WHERE 
  key_id = '47fd30b7ff97c9b92f1ed0f44886bb39b50c4198fabd1d7442cf1d194f665b0c' 
  AND (
    token = '65kcELjde/agLWH0kB5at3LrfMVw/80GWP5RIJtRlEs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023