To provide a little bit of a case study for you here: I have an i7-2600 from 2011. It still works perfectly in day-to-day processes. The only reason I replaced it was because I do video rendering and wanted something faster. It's feasible that CPU may struggle on some modern games, but it will remain suitable as a daily driver for another year or two, and I keep it around for projects or extra resources when I need it.
In other words, I'd say 7-8 years for a conservative estimate, 10 years on average, and if you're willing to stretch to the absolute limits, 11-12 may not be out of the question either. You're at a slight advantage in that the i5-8600K is a hexacore that should handle scaled workloads as programs begin to catch up to quad and hexa core setups, but at the disadvantage that you're at the tail end of what's really been a lull in terms of processor IPC and architecture improvements.
Of course, this all goes out the window if some major breakthrough is made and processors suddenly get 50-100% faster in a generational gap, or there's a huge IPC performance gain that gets utilized in next-gen hardware. Then you could see shorter lifespans similar to what we were seeing 15 years ago.