How to change appId (and productName) without breaking autoUpdater?

I want to rename an Electron app (packaged with electron-builder), but when I change the appId in package.json from e.g. com.foo.x to com.bar.y and release it, Electron’s built-in autoUpdater fails in the previously installed version with:

Error: Error: Could not locate update bundle for com.foo.x within file:///Users/<username>/Library/Caches/com.foo.x.ShipIt/update.<random_hash>/

After searching for this issue, I only found one other person dealing with the same problem. Neither the Electron nor the electron-builder docs are giving any hints.

Does anyone have a workaround or solution? Help is much appreciated.