Does serving as an expert witness violate employment agreements with typical tech employers (eg FAANG)? Assuming you are being paid and you’re witnessing for an entity other than your employer.
You should review any such planned engagements as expert witness with your employer's conflict-of-interest team. They should be able to give you the go/ahead if it's really unrelated to the company.