I have 2 MariaDB database schemas:
centauro001 and centauro005

Both database schemas have identical table structures:

CREATE TABLE `cliente` (
  `cliente_id` int(11) NOT NULL AUTO_INCREMENT,
  `nome` varchar(255) NOT NULL DEFAULT '',
  `fantasia` varchar(255) NOT NULL DEFAULT '',
  `grupo_empresarial` varchar(255) NOT NULL DEFAULT '',
  `categoria` char(1) NOT NULL DEFAULT 'N',
  `datacadastro` date NOT NULL DEFAULT '0000-00-00',
  `data_atualizacao_cadastro` date DEFAULT NULL,
  `data_consulta_serasa` datetime DEFAULT NULL,
  `tipo_pessoa` char(1) NOT NULL DEFAULT '',
  `cpf` varchar(14) NOT NULL DEFAULT '00000000000',
  `rg` varchar(13) NOT NULL DEFAULT '',
  `inscricao_estadual` varchar(30) DEFAULT NULL,
  `inscricao_municipal` varchar(30) DEFAULT NULL,
  `tel_com` varchar(50) NOT NULL DEFAULT '',
  `tel_res` varchar(50) NOT NULL DEFAULT '',
  `tel_celular` varchar(40) NOT NULL DEFAULT '',
  `pontos_fidelidade` mediumint(8) unsigned NOT NULL DEFAULT 0,
  `email` varchar(255) NOT NULL DEFAULT '',
  `quer_maladireta_email` enum('True','False') NOT NULL DEFAULT 'True',
  `quer_digital` enum('True','False') NOT NULL DEFAULT 'True',
  `quer_foto` enum('True','False') NOT NULL DEFAULT 'True',
  `unidade_origem` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `origem_cli` tinyint(3) unsigned DEFAULT NULL,
  `origem_cli_obs` varchar(255) DEFAULT NULL,
  `horamudanca` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
  PRIMARY KEY (`cliente_id`) USING BTREE,
  KEY `nome` (`nome`) USING BTREE,
  KEY `cpf` (`cpf`) USING BTREE,
  KEY `categoria` (`categoria`) USING BTREE,
  KEY `datacadastro` (`datacadastro`) USING BTREE,
  KEY `horamudanca` (`horamudanca`) USING BTREE,
  KEY `origem_cli` (`origem_cli`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

CREATE TABLE `endereco` (
  `endereco_id` int(11) NOT NULL AUTO_INCREMENT,
  `cliente_id` int(11) DEFAULT NULL,
  `identificacao` varchar(255) DEFAULT NULL,
  `tipo_endereco` tinyint(4) DEFAULT NULL,
  `data_cadastro` datetime DEFAULT NULL,
  `unidade_origem` tinyint(3) unsigned NOT NULL DEFAULT 0,
  `logradouro` varchar(255) DEFAULT NULL,
  `numero` varchar(60) DEFAULT NULL,
  `complemento` varchar(60) DEFAULT NULL,
  `bairro` varchar(60) DEFAULT NULL,
  `municipio` varchar(60) DEFAULT NULL,
  `uf` char(2) DEFAULT NULL,
  `cep` varchar(9) DEFAULT NULL,
  `cod_cidade_ibge` varchar(7) DEFAULT NULL,
  `pessoa_responsavel` varchar(255) DEFAULT NULL,
  `referencia` varchar(255) DEFAULT NULL,
  `codigo_obra` varchar(20) DEFAULT NULL,
  `endereco_ativo` enum('True','False') NOT NULL DEFAULT 'True',
  `end_envio_boleto` enum('True','False') NOT NULL DEFAULT 'False',
  `uuid_endereco` binary(16) DEFAULT NULL,
  PRIMARY KEY (`endereco_id`) USING BTREE,
  UNIQUE KEY `uuid` (`uuid_endereco`),
  KEY `cliente_id` (`cliente_id`) USING BTREE,
  KEY `end_ativo` (`endereco_ativo`) USING BTREE,
  KEY `end_env_boleto` (`end_envio_boleto`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci;

procedure GenerateUpdateScriptsForOldDataCadastro;

  function BytesToHex(const Bytes: TBytes): string;
  var
   i: Integer;
  begin
   Result:= '';
   for i:= 0 to Length(Bytes) - 1 do Result:= Result + IntToHex(Bytes[i], 2);
  end;

  function FormatSQLValue(const Value: Variant; const FieldType: TFieldType): string;
  begin
   if VarIsNull(Value) then Result:= 'NULL'
   else
    case FieldType of
     ftString, ftWideString, ftMemo, ftWideMemo, ftFixedChar, ftFixedWideChar: Result:= QuotedStr(VarToStr(Value));
     ftDate, ftDateTime, ftTime: Result:= QuotedStr(FormatDateTime('yyyy-mm-dd hh:nn:ss', Value));
     ftInteger, ftSmallint, ftWord, ftLargeint, ftAutoInc, ftFloat, ftCurrency, ftBCD, ftFMTBcd: Result:= VarToStr(Value);
     ftBytes, ftVarBytes, ftBlob, ftGraphic, ftOraBlob, ftOraClob, ftParadoxOle, ftDBaseOle: Result:= '0x' + BytesToHex(Value);
     else Result:= QuotedStr(VarToStr(Value));
    end;
  end;

 var
  QueryStore1, QueryStore2: TUniQuery;
  ScriptFile, ReportFile: TextFile;
  ScriptFileName, ReportFileName: string;
  enderecoId, clienteId: Integer;
  dataCadastro1, dataCadastro2: TDateTime;
  isStore1Newer: Boolean;
  FieldList: TStringList;
  i: Integer;
  FieldName: string;
  ValueStore1, ValueStore2: Variant;
  FieldType: TFieldType;
  Connection: TUniConnection;
  Store2Keys: TDictionary<string, TDateTime>;
  CompositeKey: string;
  SourceQuery, TargetQuery: TUniQuery;
  sqlUpdate: string;
  SetClause: string;
 begin
  ScriptFileName:= 'update_data_cadastro.sql';
  ReportFileName:= 'update_data_cadastro_report.txt';

  AssignFile(ScriptFile, ScriptFileName);
  Rewrite(ScriptFile);

  AssignFile(ReportFile, ReportFileName);
  Rewrite(ReportFile);

  QueryStore1:= TUniQuery.Create(nil);
  QueryStore2:= TUniQuery.Create(nil);
  Store2Keys:= TDictionary<string, TDateTime>.Create;

  try
   Writeln(ReportFile, 'Update Scripts for endereco Records with Older data_cadastro');
   Writeln(ReportFile, 'Generated on: ' + DateTimeToStr(now));
   Writeln(ReportFile, '--------------------------------------------------------');
   Writeln(ReportFile, '');

   Connection:= DM.LocalServer;

   QueryStore1.Connection:= Connection;
   QueryStore2.Connection:= Connection;

   QueryStore1.SQL.Text:= 'SELECT endereco_id, cliente_id, data_cadastro ' + 'FROM centauro001.endereco ORDER BY endereco_id';

   QueryStore2.SQL.Text:= 'SELECT endereco_id, cliente_id, data_cadastro ' + 'FROM centauro005.endereco ORDER BY endereco_id';

   QueryStore1.Open;
   QueryStore2.Open;

   while not QueryStore2.Eof do
   begin
    enderecoId:= QueryStore2.FieldByName('endereco_id').AsInteger;
    clienteId:= QueryStore2.FieldByName('cliente_id').AsInteger;
    dataCadastro2:= QueryStore2.FieldByName('data_cadastro').AsDateTime;

    CompositeKey:= Format('%d:%d', [enderecoId, clienteId]);
    if not Store2Keys.ContainsKey(CompositeKey) then Store2Keys.Add(CompositeKey, dataCadastro2)
    else Writeln(ReportFile, Format('Duplicate key found in centauro005 for endereco_id=%d and cliente_id=%d.', [enderecoId, clienteId]));

    QueryStore2.Next;
   end;

   QueryStore1.First;
   while not QueryStore1.Eof do
   begin
    enderecoId:= QueryStore1.FieldByName('endereco_id').AsInteger;
    clienteId:= QueryStore1.FieldByName('cliente_id').AsInteger;
    dataCadastro1:= QueryStore1.FieldByName('data_cadastro').AsDateTime;

    CompositeKey:= Format('%d:%d', [enderecoId, clienteId]);

    if Store2Keys.ContainsKey(CompositeKey) then
    begin
     dataCadastro2:= Store2Keys[CompositeKey];

     if dataCadastro1 <> dataCadastro2 then
     begin
      isStore1Newer:= dataCadastro1 > dataCadastro2;

      if isStore1Newer then
      begin
       SourceQuery:= TUniQuery.Create(nil);
       try
        SourceQuery.Connection:= Connection;
        SourceQuery.SQL.Text:= 'SELECT * FROM centauro001.endereco WHERE endereco_id = :id AND cliente_id = :cid';
        SourceQuery.ParamByName('id').AsInteger:= enderecoId;
        SourceQuery.ParamByName('cid').AsInteger:= clienteId;
        SourceQuery.Open;

        if SourceQuery.IsEmpty then
        begin
         Writeln(ReportFile, Format('Warning: Record not found in centauro001 for endereco_id=%d and cliente_id=%d.', [enderecoId, clienteId]));
        end
        else
        begin
         TargetQuery:= TUniQuery.Create(nil);
         try
          TargetQuery.Connection:= Connection;
          TargetQuery.SQL.Text:= 'SELECT * FROM centauro005.endereco WHERE endereco_id = :id AND cliente_id = :cid';
          TargetQuery.ParamByName('id').AsInteger:= enderecoId;
          TargetQuery.ParamByName('cid').AsInteger:= clienteId;
          TargetQuery.Open;

          if TargetQuery.IsEmpty then
          begin
           Writeln(ReportFile, Format('Warning: Corresponding record not found in centauro005 for endereco_id=%d and cliente_id=%d.', [enderecoId, clienteId]));
          end
          else
          begin
           FieldList:= TStringList.Create;
           try
            for i:= 0 to SourceQuery.FieldCount - 1 do
            begin
             FieldName:= SourceQuery.Fields[i].FieldName;
             if (FieldName <> 'endereco_id') and (FieldName <> 'cliente_id') then FieldList.Add(FieldName);
            end;

            // Initialize SET clause
            SetClause:= '';

            for i:= 0 to FieldList.Count - 1 do
            begin
             FieldName:= FieldList[i];
             ValueStore1:= SourceQuery.FieldByName(FieldName).Value;
             FieldType:= SourceQuery.FieldByName(FieldName).DataType;

             if i > 0 then SetClause:= SetClause + ', ';

             SetClause:= SetClause + Format('%s = %s', [FieldName, FormatSQLValue(ValueStore1, FieldType)]);
            end;

            // Construct the full UPDATE statement
            sqlUpdate:= Format('UPDATE centauro005.endereco SET %s WHERE endereco_id = %d AND cliente_id = %d;', [SetClause, enderecoId, clienteId]);

            Writeln(ScriptFile, sqlUpdate);

            Writeln(ReportFile, Format('endereco_id=%d, cliente_id=%d: Updated centauro005.endereco (data_cadastro=%s) ' + 'with data from centauro001.endereco (data_cadastro=%s)',
              [enderecoId, clienteId, DateTimeToStr(dataCadastro2), DateTimeToStr(dataCadastro1)]));
            Writeln(ReportFile, sqlUpdate);
            Writeln(ReportFile, '--------------------------------------------------------');
           finally
            FieldList.Free;
           end;
          end;
         finally
          TargetQuery.Free;
         end;
        end;
       finally
        SourceQuery.Free;
       end;
      end
      else
      begin
       SourceQuery:= TUniQuery.Create(nil);
       try
        SourceQuery.Connection:= Connection;
        SourceQuery.SQL.Text:= 'SELECT * FROM centauro005.endereco WHERE endereco_id = :id AND cliente_id = :cid';
        SourceQuery.ParamByName('id').AsInteger:= enderecoId;
        SourceQuery.ParamByName('cid').AsInteger:= clienteId;
        SourceQuery.Open;

        if SourceQuery.IsEmpty then
        begin
         Writeln(ReportFile, Format('Warning: Record not found in centauro005 for endereco_id=%d and cliente_id=%d.', [enderecoId, clienteId]));
        end
        else
        begin
         TargetQuery:= TUniQuery.Create(nil);
         try
          TargetQuery.Connection:= Connection;
          TargetQuery.SQL.Text:= 'SELECT * FROM centauro001.endereco WHERE endereco_id = :id AND cliente_id = :cid';
          TargetQuery.ParamByName('id').AsInteger:= enderecoId;
          TargetQuery.ParamByName('cid').AsInteger:= clienteId;
          TargetQuery.Open;

          if TargetQuery.IsEmpty then
          begin
           Writeln(ReportFile, Format('Warning: Corresponding record not found in centauro001 for endereco_id=%d and cliente_id=%d.', [enderecoId, clienteId]));
          end
          else
          begin
           FieldList:= TStringList.Create;
           try
            for i:= 0 to SourceQuery.FieldCount - 1 do
            begin
             FieldName:= SourceQuery.Fields[i].FieldName;
             if (FieldName <> 'endereco_id') and (FieldName <> 'cliente_id') then FieldList.Add(FieldName);
            end;

            // Initialize SET clause
            SetClause:= '';

            for i:= 0 to FieldList.Count - 1 do
            begin
             FieldName:= FieldList[i];
             ValueStore2:= SourceQuery.FieldByName(FieldName).Value;
             FieldType:= SourceQuery.FieldByName(FieldName).DataType;

             if i > 0 then SetClause:= SetClause + ', ';

             SetClause:= SetClause + Format('%s = %s', [FieldName, FormatSQLValue(ValueStore2, FieldType)]);
            end;

            // Construct the full UPDATE statement
            sqlUpdate:= Format('UPDATE centauro001.endereco SET %s WHERE endereco_id = %d AND cliente_id = %d;', [SetClause, enderecoId, clienteId]);

            Writeln(ScriptFile, sqlUpdate);

            Writeln(ReportFile, Format('endereco_id=%d, cliente_id=%d: Updated centauro001.endereco (data_cadastro=%s) ' + 'with data from centauro005.endereco (data_cadastro=%s)',
              [enderecoId, clienteId, DateTimeToStr(dataCadastro1), DateTimeToStr(dataCadastro2)]));
            Writeln(ReportFile, sqlUpdate);
            Writeln(ReportFile, '--------------------------------------------------------');
           finally
            FieldList.Free;
           end;
          end;
         finally
          TargetQuery.Free;
         end;
        end;
       finally
        SourceQuery.Free;
       end;
      end;
     end;
    end;
    QueryStore1.Next;
   end;

  finally
   Store2Keys.Free;
   QueryStore1.Free;
   QueryStore2.Free;
   CloseFile(ScriptFile);
   CloseFile(ReportFile);
  end;

  ShowMessage('Update scripts and report have been generated successfully.' + sLineBreak + 'Script File: ' + ScriptFileName + sLineBreak + 'Report File: ' + ReportFileName);
 end;

end.

Change the way that the updates on this method are done. Use something like:
REPLACE INTO centauro005.endereco SELECT * FROM centauro001.endereco_id