UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uKpwikjmIYxAQeFXNM5wYIiNtwh+krp7RdiziPNz6yQ=' 
WHERE 
  key_id = '7ec617ab5eefed25a476785e51fedde1214bfe4143773f22b31a6668da295d6f' 
  AND (
    token = 'uKpwikjmIYxAQeFXNM5wYIiNtwh+krp7RdiziPNz6yQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048