UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9p8U3vVYe08Q+DctZKhq7xFTdCvgeo1OJU6GoU47Sk4='
WHERE
key_id = '49893d72a147cbd6b7d22a2f655963e99cf7957020c392f679203851e5eaa5ef'
AND (
token = '9p8U3vVYe08Q+DctZKhq7xFTdCvgeo1OJU6GoU47Sk4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)