Hi Kornel!
This issue usually happens when your Microsoft Store, Xbox App, and Minecraft Launcher are logged into different accounts, or your login session is corrupted.
First, go to account.microsoft.com/billing/orders to make sure the Ultimate Edition key was successfully redeemed on the exact Microsoft account you are currently using. Next, open the Microsoft Store and the Xbox App on your PC, sign out of both completely, and then sign back in using that same account. Finally, press Windows Key + R, type wsreset.exe, and click OK to clear your store cache. This should refresh your licenses, stop the constant logouts, and unlock your DLCs.