mysql – SQL Assignment query

I have 2 databases – one with customers’ data and the second one with discount codes. I would like to assign code to each customer. The code can be assigned only once, so I would like to mark the code as ‘used’ once it is assigned. The codes should be assigned only to those customers that don’t have a code assigned.

CUSTOMER_DATABASE:

CUSTOMER ID CUSTOMER CODE
1 6f73js
2

DATA_DISCOUNT_CODES:

ID CODE STATUS
1 6f73js USED
2 kdw45s

Could you please help me write SQL query for this, using MySQL 8.0 syntax?