UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QlU2HjMOJw60kiFCGQWHI2vkfuzZKydmgnHi3olEUY4='
WHERE
key_id = '0829e16ad4861003ffe8d4834d7c24f6e12a79afa9ddba0127cfe11b11331d65'
AND (
token = 'QlU2HjMOJw60kiFCGQWHI2vkfuzZKydmgnHi3olEUY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)