UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mXiGXbj1E2x270NuDDIkyLQeJDTFRxJGyCEXqxxfk54='
WHERE
key_id = '8dd565c43a71da61591a45d0d918c3795b962fcf284aa7ad1aaf3aa05adf1a39'
AND (
token = 'mXiGXbj1E2x270NuDDIkyLQeJDTFRxJGyCEXqxxfk54='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)