Optimize deletion of tracks on a rescan

Replace some of the expensive DBIC code with native SQL