UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pwteEFkdOZQbcEK/gGdaWZ8BP4GVyhP0sSaUwM8UikM='
WHERE
key_id = 'c433a295a826067183c8bb9fd8e1820e6d897c263c7d23ea5776d99c153dcfb4'
AND (
token = 'pwteEFkdOZQbcEK/gGdaWZ8BP4GVyhP0sSaUwM8UikM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)