How do we declare variable in update query in couchbase

I would like to declare a temporary variable inside an update query, something like this in sql:
UPDATE
users IU
INNER JOIN activity_stats DAS
ON (IU.user_id=DAS.for_user_id)
SET
IU.used_time = (@usedtime := unix_timestamp() - IU.start_date),
IU.time_period_left = CASE WHEN (@timeleft := IU.total_subscription_time - @usedtime) > 0 THEN @timeleft ELSE 0 END,
IU.status = CASE WHEN @timeleft > 0 THEN ‘A’ ELSE ‘I’ END,
DAS.total_time_used = DAS.total_time_used + @usedtime
WHERE
IU.time_period_left > 0
AND IU.status=‘A’

with the variable @usedtime.
Another example:
DECLARE @temp varchar(20)
SET @temp = ‘testing, or the result of a query maybe?’

UPDATE T SET T.property1 = @temp
FROM #temp_table_name T
WHERE 1 = 1

N1QL doesn’t support procedure language. You need to repeat expression.
Only SELECT allows to define variable using CTE or LET. Not UPDATE/UPSERT/INSERT/MERGE.

Also UPDATE joins are not supported. You can use MERGE