Check if any of the values is in a subquery result
Try:

where exists (select * .... 
        where Customers.orderId = ... 
        or Customers.secondaryId = ...
     )


Eg, if you were planning on:

where orderId in (select value from ...)
or secondaryorderid in (select value from ...)


Then you make it so that you only call your subquery once, and build your OR clause into it.

 where exists (select * from ... 
        where Customers.orderId = value 
        or Customers.secondaryOrderId = value
     )


The whole point of this is to ensure that the complicated subquery is only executed one time. That doesn't happen with a CTE, or by replacing two INs with two EXISTSs.