Barry,remove foreign key
from table using SET foreign_key_checks = 0;
then run marius update query. after that enable foreign key of table SET foreign_key_checks = 1;
Make a clone of table catalog_product_link.I guess table is close table name is catalog_product_link_cp
Query 1:
UPDATE catalog_product_link
SET catalog_product_link.link_type_id = 4 where catalog_product_link.link_id in (select catalog_product_link_cp.link_id from catalog_product_link_cp where catalog_product_link_cp.link_type_id = 5 )
Query 2:
UPDATE catalog_product_link
SET catalog_product_link.link_type_id = 5 where catalog_product_link.link_id in (select catalog_product_link_cp.link_id from catalog_product_link_cp where catalog_product_link_cp.link_type_id = 4 )