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