Here is you how you check whether an SSL cert is valid and hasn't yet expired
Retrieve the certificate.
$ echo "" | openssl s_client -connect server:443 > certificate
Check the expiration date of the certificate.
$ openssl x509 -in certificate -noout -enddate
Or you can use ssl-cert-check or check-expire