In the file /etc/systemd/system/xlock@.service, put the following.
[Unit] Description=Lock X session using xlock for user %i Before=sleep.target [Service] User=%i Environment=DISPLAY=:0 ExecStartPre=/usr/bin/xset dpms force suspend ExecStart=/usr/bin/xlock [Install] WantedBy=sleep.target
Now, to activate locking on suspend, do systemctl enable xlock@user where user is your user.
Note: Pretty much the same as the Archlinux wiki's slock entry, but for xlock.