UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4sAhr17ZZorj6ZMDQgpONM13vNlzPaEQfi9S5Dljpf8='
WHERE
key_id = '03e1e3e6e42efe659b97b81da3babaa49781390e2b3ab0c02f24514531b6d764'
AND (
token = '4sAhr17ZZorj6ZMDQgpONM13vNlzPaEQfi9S5Dljpf8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)