UPDATE orders
JOIN trackingnumbers on orders.OrderID = trackingnumbers.OrderID 
SET orders.ShippingMethodID = 204
WHERE trackingnumbers.Gateway IN ('FedEx', 'FEDEX', 'fedex')
AND orders.orderstatus IN ('Processing','Pending Shipment')
AND orders.CustomerID != 386772
AND orders.Custom_Field_CATReason != 'RE-SHIP UPGRADE'
AND orders.ShippingMethodID != 204
