The easiest way is to reinstall latest MIUI : download tool & MIUI from here.
In the tool, don’t forget to check for “flash_all” and not “flash_all_lock” at bottom right (this way, your device won’t get locked again).
Anyway, before anything don’t forget to take a full TWRP backup of your working device, and copy your personal files to a computer (using USB MTP) !
Please don’t forget to wipe System + Dalvik/Cache and format Data before applying the /e/ Q image.
Sorry, you will lose your settings and installed apps.