Возможен примерно так:
delete from ok_images where product_id in (select product_id from ok_products_categories where category_id in (17));
delete from ok_images where product_id in (select product_id from ok_products_categories where category_id in (17));