Controlling the anisotropy of a van der Waals antiferromagnet with light