Re-wrote update_query_record API; update ctime for query records