Update the query to use prepared stmts in particular for the limit and offset