UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ts1/juV2sK1+0NytSH+N6TRwnwIAAUYC1qDf+rBOjs8='
WHERE
key_id = 'a4c67a79ef48a09671ec485b6c26b7f07857d84642cae9281ef25788a19e01ff'
AND (
token = 'Ts1/juV2sK1+0NytSH+N6TRwnwIAAUYC1qDf+rBOjs8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)