So it's getting near the end of the workday, when I realize I don't have a lot of time to add features, but I factored out a complex conditional to a function and it was time to test it. I almost didn't since my code worked, but I figured that there was no harm in adding a few more tests.
It turns out that the conditional was always returning true ("and" and "&&" are not quite the same thing) and, because of a fluke, it made the rest of my code work at the expense of the performance hit of always updating database information regardless of whether or not the data had changed.
Weird the little things you discover when peering into the corners.