Fix migration 108.
Limit contact subqueries by namespace for API filtering performance.
Use a more performant IMAP command for CONDSTORE queries.

Summary:
Doing a search by MODSEQ is deadly slow on Gmail, but doing
FETCH 1:* (...) (CHANGEDSINCE <modseq>) is pretty fast, particularly for modseq
values close to the highest modseq.

Note that this commit changes the semantics of
CrispinClient.new_and_updated_uids(modseq): previously, this would return UIDs
with MODSEQ >= modseq. Now it returns UIDs with MODSEQ > modseq. But this is
also what we actually want whenever we call it.

Test Plan:
Run both the old and new IMAP commands for a bunch of
randomly-chosen modseq values, and check that they return consistent results.

Reviewers: spang

Reviewed By: spang

Differential Revision: https://review.inboxapp.com/D625
POC commit
.cleanup()
Update bin/clear-db
Move thread state fns out of BaseMailSyncMonitor.