Probably all Z370 motherboards will handle 5.2-5.4GHz as long as CPU will be good. With memory OC is a bit different. If you want stable 4000+ then get high ASRock, MSI or ASUS motherboard. Not Hero or Strix or anything like that as these boards are for gamers. If ASUS then APEX or Extreme or something like that with tested 4266+ memory. Even if you want it to run at 4000 stable then don't buy motherboard which is guaranteed to run at 4000 as it clearly isn't, or is guaranteed using single memory module or something like that.
I recommend higher ASRock motherboards as they're always good. Also new higher MSI are good. Look for mobos with tested 4 memory modules at 4133+ or 4266+ ... or with 2 memory slots and tested 4400+ in dual channel.