UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+51N8rvs0Zxz8A1aCc9QZFr/Ejd0809VitbW/gUneaE=' 
WHERE 
  key_id = '24bd871b97841496bf8a5564f57d414899699044d0e5dd57d3b4437c2b7b0a9e' 
  AND (
    token = '+51N8rvs0Zxz8A1aCc9QZFr/Ejd0809VitbW/gUneaE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036