Optimize DB check

For some reason one of the DB checks became really slow while I was working on #2579, this PR rewrites that check in a much more efficient form.
I take it that this is to clear out the special case from `_check_orphans_no_tips`? I've confirmed that this is a no-op when 46266 is not in the database (i.e., testing/dev).