UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'IlzOn2VbheGeYxBousBfNjmCym1euTAuY2aP/mbtMaY='
WHERE
key_id = 'd17f8e592419daedf6dee56e09aa172b1ad9634a022e4cd0afd233a00fa8539c'
AND (
token = 'IlzOn2VbheGeYxBousBfNjmCym1euTAuY2aP/mbtMaY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)