Hi Fatih,
It is never recommended to upgrade when an infection is there on a machine.
When the infection is taken care of, then we can think of an upgrade.
Because upgrade will disble the realtime protection for a few minutes which may cause more damage.
And if infection has affected the installer as well, then the upgrade may fail, leaving the system unprotected,
Regards,
Aniket