Reapply thermal paste and make sure that the cooler is mounted properly...Make sure you connected the fan to the motherboard.
If,after all this,the temps stay the same,you can install a monitoring program ( Ryzen Master or MSI Afterburner,CPU/GPU-Z etc.) and see what's exactly happening when the system idles and gets stressed.(Voltages,Fans RPMs etc.)
If the Voltages are stuck at 1.4+,which happened to me before,you can go into the BIOS and load the default settings or reset CMOS...If this don't fix the issue you can update the BIOS.