Setting $DISPLAY with cron

I've been trying to get my screen to lock every half hour, and thus far it hasn't been effective, as cron (or technically my client, cronie) throws errors and does nothing. Errors below (sourced from systemctl status cronie):

pam_unix(crond:session): session opened for user uk000(uid=1000) by (uid=0)
(uk000) CMD (XAUTHORITY=~/.Xauthority && DISPLAY=:0 && slock)
(uk000) CMDOUT (slock: cannot open display)
(uk000) CMDEND (XAUTHORITY=~/.Xauthority && DISPLAY=:0 && slock)
pam_unix(crond:session): session closed for user uk000

My $DISPLAY variable is set in .zshrc and the command used in cron works when executed as normal. I've tried this with another screenlocker, and got a similar error.

The cron job, at the moment, looks like (it's running every minute for debugging purposes)

* *   * * * XAUTHORITY=~/.Xauthority && DISPLAY=:0 && slock

(I have also tried different displays, to no avail)


Environment variables need to be defined when using cronie, and I defined them incorrectly. An effective crontab looks like

*/20 *   * * * export DISPLAY=:0; slock