Your Ruby ActiveRecord query is so under optimized, you are loading a ton of records that instantiate objects and then apply a filter on this huge array.
I'm pretty sure you could make it 100x faster.
I don't think those are ActiveRecord queries, they look like calls to the Stripe api via the Stripe gem. It's possible those filters like 'deleted?' are not able to be applied when querying the API.
I think someone else has pointed out that they're not ActiveRecord queries, but even if they were, this is a script designed to be run manually a few times a week, which takes maybe a minute. You'd need significantly more than 100x performance increase for any time at all put into optimising queries to pay for themselves.