Ok some more results of my investigation.
1) It appears that this mess happens when a user accidently creates a web site with the domain name www.<domain> then deletes this site and recreates it, without empting the recycle bin, as just <domain>. It may be that they just edit the current record and remove www. This seems to confuse the isp_isp_domain table.
2) I had to update the table isp_isp_domain and set the domain_host to null. This seems to fix postfix problems.
3) I still have problems trying to delete and recreate the mx records. I keep being told the MX record is already registered. Its almost impossible to tell which record needs to be deleted from dns_mx as I am not sure what the doc_id links to. This doc_id appears refer to different entities in each table.
" This or a similar MX Record does already exist in this zone."
4) I found some orphaned cname records in dns_cname which I deleted. I really cant see how these tables are linked? The doc_id seems completely random and doesnt seem to link to primary keys in another table.
Will report back later.