UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7RSnojgaUROhwn+fth8qNLKc5f6LKehU6/B0v7pJSx8='
WHERE
key_id = '4af693ca8323bd842a33daff53fa34cd5f9d7047235363560cd8dc4652da9d08'
AND (
token = '7RSnojgaUROhwn+fth8qNLKc5f6LKehU6/B0v7pJSx8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)