How to update Server CA certificate in ESP32

Hi, I am using ESP32 with API calls (HTTPS) with hardcoded Server CA Certificate. But those will expire every year and need to put a new certificate once it got expired. I am thinking to automate this process such that as soon as the old certificate expires new certificate will be updated on the device side to avoid interruptions.

How it can be done. Any inputs?

PS: Intermediate and Root certificates have longer expiration dates almost 20 to 30 years. Can we adopt them in ESP32?