Alter a specific query on WordPress

You might be able to use the query filter hook

See this WPSE answer

Basically, you can do something like:

add_filter( 'query', 'your_filter_function' );

function your_filter_function($query_sql) {
    // do something to $query_sql
    return $query_sql;
}

This will get called for every query, so you’ll need to test $query_sql to make sure it’s the query you want.