miconda left a comment (kamailio/kamailio#4275)
I expect that introducing the use of raw_query breaks the usage of the module with non-sql backends (e.g., db_text), so another solution has to be found.
Maybe leveraging another column (e.g., priority set to -1 for cleaning up records) or adding a new column.