Я пробовал сделать
sqlite3 -cmd "DELETE FROM tc_positions WHERE fixTime < DATE(DATE_ADD(NOW(), INTERVAL -3 DAY)) AND id NOT IN (SELECT positionId FROM tc_devices WHERE positionid IS NOT NULL) LIMIT 10000" database.mv.db
MySQLite is an easy way to add MySQL functions to SQLite accessed through PDO.