How do I process a huge list of files?
You can try

Method I - Using Cron and queue


Cron will run the query and push the list of nodes to the queue
queue will pick the items one by one and Unpublish them


Method - II Using Cron and batch


Cron will run the query and push the list of nodes to the Batch process
Batch process will be launched programmatically using background_process module


References 


Batch API
How to create a batch operation in Drupal 7
SE Answer
D.ORG post