Prevent extra queries in `ancestor_has_staff_lock`