update query logic, add delay