UPDATE final_products f
INNER JOIN cutting_jobs cj ON cj.source_type='finished' AND cj.source_id = f.id
SET f.sale_status = 'cut'
WHERE f.sale_status <> 'cut';

UPDATE final_products fp JOIN invoice_items ii ON ii.final_product_id=fp.id 
SET fp.sale_status="sold" 
WHERE ii.invoice_id='.(int)$invoice_id.' AND fp.sale_status="reserved"