There was a SSL problem some weeks ago but it’s gone now. if you still experience certificate problems it really must be because of your old SfOS version.
Xperia XZ2 is a community port (OP could have mentioned this) and at the moment 5.0.0.67 is the newest version available for that. Probably just expired cert files on the port.
I have version 5.1.0.11 on an Xperia 10 iii and I am seeing this curl error as well. I don’t get it all the time, but perhaps 50% of the time when I try to download new apps or update existing ones.