How MySQL Implicit Type Conversion Turned an Indexed Query Into a 7M-Row Scan

It was supposed to be a standard, run-of-the-mill maintenance task—the kind of routine database housekeeping that backend engineers perform dozens of times a month without a second thought. A small batch of customer account records needed a minor state update so they could be placed back into the queue for reassignment. No complex migrations, no structural database refactoring, and certainly no high-stakes schema changes. Just a simple UPDATE statement. Yet, in a high-scale production environment, "simple" is a dangerous word. It is a word that breeds complacency. Before executing the script against our production cluster, I took a step that every engineer should treat as a muscle reflex: I
…