Tweak query logic

Tweaking query logic in `is_active` to be simpler, and probably (very) slightly faster.