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

Query time 0.00036