UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xSj6MRLsBs5NcW+j4mQ3UA08U7fr50O956AzbxI9FKM='
WHERE
key_id = '38c50f4707d4861bb358b580c40b52fc9055be6f9574eccb51a38ca6d51a5bc0'
AND (
token = 'xSj6MRLsBs5NcW+j4mQ3UA08U7fr50O956AzbxI9FKM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)