First, try updating Xcode through the app store
As a last resort, you can change your MacOS Date to
1st October 2019
I set my system time to 1st October 2019, the date when the certificate was still valid. Then, I opened Xcode and followed the component install. This went well, and now Xcode works again.
Edit and set the date of your Mac as 1st October 2019.