Expire queries only after maxQueryAge

This fixes a regression introduced in c918b549cf0cca6c3329b8f8ea5c9d23beadb128, where
the expiration queue would get trimmed to maxQueryHistory regardless of how long ago
the queries had finished. This can result in clients getting "not found" errors
in highly loaded clusters that retire queries quickly.

This implementation now keeps queries around until for at least maxQueryAge after
they are finished, but it can keep them longer if the history is less than maxQueryHistory
 long.