- Replace DATE_SUB(NOW(), INTERVAL 300 SECOND) with Python-level time check - Replace NOW() with parameterized timestamps from Python - Lockout check now done in _is_locked() function (DB-agnostic) - All UPDATE statements use parameterized values, not DB functions - Works with MySQL, PostgreSQL, SQLite, SQL Server, Oracle