UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Iw0zISLAYzc0Yt2ZZ8WP6sEsfgYUlp14NZoTUAM3nc4='
WHERE
key_id = 'b59e535624ef9d4e3c1dcbc070c81eadd8541123ccc6a3c6bd66c3c902571114'
AND (
token = 'Iw0zISLAYzc0Yt2ZZ8WP6sEsfgYUlp14NZoTUAM3nc4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)