A lot of signs point to yes on this, it would be fine. As long as you do a good job cleaning off and reapplying a good thermal paste and clean and dust from previous use.
Both are CPUs are rated at 65W so the cooling solutions designed for the 1700 would be adequate for the power consumption of the 5600x. The 1700 had the Spire with LED, and the 5600x comes with the stealth. Most comments show that the Spire has better cooling than the smaller and quieter Stealth.
A List of what comes with each is found here:
https://www.amd.com/en/technologies/cpu-cooler-solution
Best bet though is to load up CPUZ and HWMonitor after install (both free). Run the benchmark then stress test on CPUZ while keeping an eye on temps in HWMonitor (sensors version). If anything seems off or get near Max. Operating Temperature (Tjmax) 95°C, then shut down and check for fit and paste distribution. But you should be good.