UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '+DYmuHK+WgyW1bSPUGPmwXfhIERiOErBMnufmjOLeXk=' 
WHERE 
  key_id = 'a8b8d4077c21ab9418a107c450feb468a71454f29f2a9db560365ebcadefdad3' 
  AND (
    token = '+DYmuHK+WgyW1bSPUGPmwXfhIERiOErBMnufmjOLeXk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025