You can always use a pcie sound card which has a toslink connector like the one below:
Creative Sound Blaster Audigy PCIe RX 7.1 Sound Card 106 DB SNR/192 kHz Optimal Recording Solution with High-Performance Headphone Amp
https://amzn.eu/d/iYTwIRQ
Some motherboards even come with an optical audio out built in to the rear I/O.