Make deleteOldLogs query compatible with MS Sql

Pretty self explanitory and easy.