UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '49H3+y/gtm87g/sjG10T2IG6Rg8v5NGSobbVQ6ge8rw='
WHERE
key_id = 'f9040eeebcacdd7ec5bb2e7fa7c5febfe83ef435a08670a01ce65c71a8c6b542'
AND (
token = '49H3+y/gtm87g/sjG10T2IG6Rg8v5NGSobbVQ6ge8rw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)