Recently found an issue when trying to reinstall Microsoft Security Essentials on a Windows 7 machine after Sophos Cloud Protection was uninstalled. Constant tries of installing and making sure the machine had all Windows Updates installed and was clean after running Malwarebytes.
I found my self still getting the error 0x80070645, several goes at trawling forums finally found that deleting a registry key fixed the problem.
Delete the following registry key:
HKEY_CLASSES_ROOT > Installer > UpgradeCodes >26D13F39948E1D546B0106B5539504D9
Then reinstall Microsoft Security Essentials, you may find that it does not update first time but after a reboot all is well.