Coursepress extremely slow to login

We use coursepress. We have over 21000 students and our wp_postmeta has 4.3 million rows. When students try to login it takes like 30 seconds. Its awful. It just sits there. It grew from taking 5 seconds to login to now 30 seconds over about 3 months. We can't tolerate it anymore.

Is there anything that can be done to speed this up? I've posted this question before, and the response I get is the typical nonsense like "try a database optimizing plugin", as if that will do anything. it will not. accessing the database, even know its huge, is still instant. I do a "show proceeslist" with mysql as it sits there trying to login and coursepress is doing a few of these:
SELECT umeta_id FROM wp_usermeta WHERE meta_key = 'session_tokens' AND user_id = 21011
and this
SELECT wp_posts.ID FROM wp_posts INNER JOIN wp_postmeta ON ( wp_posts.ID = wp_postmeta.post_id )

but these (and all) queries are instant. They don't sit there sleeping. they always complete instantly. so its coursepress, its programmed poorly because I guess it loads these query results into PHP arrays and processes the arrays, thats what takes so long. extremely poor quality code within coursepress.

my question is, can anything be done about this? and if not is there a PHP code example to programmatically delete students from the database? The idea being we simply prune all students from coursepress that have completed the course. I can't sit there and click delete 21000 times, but do have a CSV I can loop through with student numbers, I would like to delete them. how can I do this?