Updates insert query to correctly set the last query time