Do you use
Advisor - Secure WordPress Websites recommendation for such changing?
Could you please also let me know the full scenario which requires you to change http to https periodically (or maybe even more offen)?
Please also note that WordPress Toolkit since version 4.6.0 has Update Site URL option which should address your request.
View attachment 16591