AND Logic to turn on the led

how do I turn on the led with logical AND operator?
both messages are in msg.payload.

You would have to join the messages, then apply your logic. This can be done in a function, change node or you could use boolen logic ultimate
here is an example using a change node.

 [{"id":"f3bab7c9d9c50549","type":"inject","z":"fe76f7928e585317","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"table1","payload":"true","payloadType":"bool","x":120,"y":1960,"wires":[["f32fafd61d2b728c"]]},{"id":"f32fafd61d2b728c","type":"join","z":"fe76f7928e585317","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":290,"y":2040,"wires":[["0bc9af6a8ba454b7"]]},{"id":"a45d8f06f1a1a1ee","type":"inject","z":"fe76f7928e585317","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"table1","payload":"false","payloadType":"bool","x":130,"y":2000,"wires":[["f32fafd61d2b728c"]]},{"id":"de601e2d4778e239","type":"inject","z":"fe76f7928e585317","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"table2","payload":"true","payloadType":"bool","x":140,"y":2100,"wires":[["f32fafd61d2b728c"]]},{"id":"8c44f3d5af72b18d","type":"inject","z":"fe76f7928e585317","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"table2","payload":"false","payloadType":"bool","x":150,"y":2140,"wires":[["f32fafd61d2b728c"]]},{"id":"0bc9af6a8ba454b7","type":"change","z":"fe76f7928e585317","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$not(false in $$.payload.*)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":2040,"wires":[["048ab2e2b5799854"]]},{"id":"048ab2e2b5799854","type":"ui_led","z":"fe76f7928e585317","order":15,"group":"2d4fe667.28f8ba","width":0,"height":0,"label":"","labelPlacement":"left","labelAlignment":"left","colorForValue":[{"color":"#ff0000","value":"false","valueType":"bool"},{"color":"#008000","value":"true","valueType":"bool"}],"allowColorForValueInMessage":false,"shape":"circle","showGlow":true,"name":"","x":610,"y":2040,"wires":[]},{"id":"2d4fe667.28f8ba","type":"ui_group","name":"demo","tab":"1caa8458.b17814","order":1,"disp":true,"width":"12","collapse":false},{"id":"1caa8458.b17814","type":"ui_tab","name":"Demo","icon":"dashboard","order":1,"disabled":false,"hidden":false}]

sometimes the and operator doesn't work perfectly on your flow, I tried boolean logic ultimate, but I need a topic. how to generate topic and payload simultaneously like your flow?

I failed to do with flow like the following picture

You have not provide enough info, so difficult to help you.
Please provide an example flow with input data, also please explain your and logic you wish to apply.

this is my flow, how to apply the and operator to the flow? thank you for your help

[
    {
        "id": "fe23ebf967cff990",
        "type": "switch",
        "z": "46af9c65977c5ac5",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "nempty"
            },
            {
                "t": "empty"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1270,
        "y": 400,
        "wires": [
            [
                "4b83793716b7210a"
            ],
            [
                "b995f0846e432612"
            ]
        ]
    },
    {
        "id": "b995f0846e432612",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "false",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "driver_check_false",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1410,
        "y": 420,
        "wires": [
            [
                "b694cf5ede94ab0a"
            ]
        ]
    },
    {
        "id": "4b83793716b7210a",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "true",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "driver_check_true",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1410,
        "y": 380,
        "wires": [
            [
                "b694cf5ede94ab0a"
            ]
        ]
    },
    {
        "id": "174b93e73f95cc66",
        "type": "inject",
        "z": "46af9c65977c5ac5",
        "name": "empty",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 1130,
        "y": 420,
        "wires": [
            [
                "fe23ebf967cff990"
            ]
        ]
    },
    {
        "id": "2fcb49035bab89bf",
        "type": "inject",
        "z": "46af9c65977c5ac5",
        "name": "not empty",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "not empty",
        "payloadType": "str",
        "x": 1120,
        "y": 380,
        "wires": [
            [
                "fe23ebf967cff990"
            ]
        ]
    },
    {
        "id": "3b636428211058f5",
        "type": "switch",
        "z": "46af9c65977c5ac5",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "nempty"
            },
            {
                "t": "empty"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1270,
        "y": 500,
        "wires": [
            [
                "945d4e1fe79a8155"
            ],
            [
                "f475e721df7390f3"
            ]
        ]
    },
    {
        "id": "f475e721df7390f3",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "false",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "driver_check_false",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1410,
        "y": 520,
        "wires": [
            [
                "b694cf5ede94ab0a"
            ]
        ]
    },
    {
        "id": "945d4e1fe79a8155",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "true",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "driver_check_true",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1410,
        "y": 480,
        "wires": [
            [
                "b694cf5ede94ab0a"
            ]
        ]
    },
    {
        "id": "5a7fdd326dc7cebb",
        "type": "inject",
        "z": "46af9c65977c5ac5",
        "name": "empty",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "str",
        "x": 1130,
        "y": 520,
        "wires": [
            [
                "3b636428211058f5"
            ]
        ]
    },
    {
        "id": "aab8d9bd798f5b09",
        "type": "inject",
        "z": "46af9c65977c5ac5",
        "name": "not empty",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "not empty",
        "payloadType": "str",
        "x": 1120,
        "y": 480,
        "wires": [
            [
                "3b636428211058f5"
            ]
        ]
    },
    {
        "id": "b694cf5ede94ab0a",
        "type": "BooleanLogicUltimate",
        "z": "46af9c65977c5ac5",
        "name": "",
        "payloadPropName": "payload",
        "filtertrue": "both",
        "persist": true,
        "sInitializeWith": "WaitForPayload",
        "triggertopic": "trigger",
        "outputtriggeredby": "all",
        "inputCount": 2,
        "topic": "result",
        "restrictinputevaluation": false,
        "delayEvaluation": 0,
        "x": 1570,
        "y": 460,
        "wires": [
            [
                "5f521f6e4526fbed"
            ],
            [],
            []
        ]
    },
    {
        "id": "5f521f6e4526fbed",
        "type": "debug",
        "z": "46af9c65977c5ac5",
        "name": "debug 9",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1740,
        "y": 440,
        "wires": []
    }
]

In your four change nodes you are setting msg.topic to one of two different values: "driver_check_true" and "driver_check_false".

I suspect you would be better to set it to "driver_check" in the first pair of change nodes and "vehicle_check" in the second pair.

It certainly makes no sense to include true or false in msg.topic, that's what msg.payload is carrying.

ps
You can simplify your flow if you use regular expressions in the change nodes.

[{"id":"174b93e73f95cc66","type":"inject","z":"18381fb65c388da3","name":"empty","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":190,"y":160,"wires":[["0fa90c527b69d626"]]},{"id":"2fcb49035bab89bf","type":"inject","z":"18381fb65c388da3","name":"not empty","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"not empty","payloadType":"str","x":180,"y":120,"wires":[["0fa90c527b69d626"]]},{"id":"5a7fdd326dc7cebb","type":"inject","z":"18381fb65c388da3","name":"empty","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":190,"y":260,"wires":[["2f1f1acfe396a5dd"]]},{"id":"aab8d9bd798f5b09","type":"inject","z":"18381fb65c388da3","name":"not empty","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"not empty","payloadType":"str","x":180,"y":220,"wires":[["2f1f1acfe396a5dd"]]},{"id":"b694cf5ede94ab0a","type":"BooleanLogicUltimate","z":"18381fb65c388da3","name":"","payloadPropName":"payload","filtertrue":"both","persist":true,"sInitializeWith":"WaitForPayload","triggertopic":"trigger","outputtriggeredby":"all","inputCount":2,"topic":"result","restrictinputevaluation":false,"delayEvaluation":0,"x":630,"y":200,"wires":[["5f521f6e4526fbed"],[],[]]},{"id":"5f521f6e4526fbed","type":"debug","z":"18381fb65c388da3","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":800,"y":200,"wires":[]},{"id":"2f1f1acfe396a5dd","type":"change","z":"18381fb65c388da3","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"^.+$","fromt":"re","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"^$","fromt":"re","to":"false","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"vehicle_check","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":240,"wires":[["b694cf5ede94ab0a"]]},{"id":"0fa90c527b69d626","type":"change","z":"18381fb65c388da3","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"^.+$","fromt":"re","to":"true","tot":"bool"},{"t":"change","p":"payload","pt":"msg","from":"^$","fromt":"re","to":"false","tot":"bool"},{"t":"set","p":"topic","pt":"msg","to":"driver_check","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":140,"wires":[["b694cf5ede94ab0a"]]}]

Here is an example using change nodes and JSONata. the payloads are converted to true false, the messages are then joined. if either message contains a false the output is false, else output is true if both payloads are true.

[{"id":"2fcb49035bab89bf","type":"inject","z":"fe76f7928e585317","name":"not empty","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"not empty","payloadType":"str","x":140,"y":2240,"wires":[["4b83793716b7210a"]]},{"id":"4b83793716b7210a","type":"change","z":"fe76f7928e585317","name":"true/false","rules":[{"t":"set","p":"payload","pt":"msg","to":"$$.payload != \"\"","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"driver_check","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":2260,"wires":[["9124c2454fb2743b"]]},{"id":"174b93e73f95cc66","type":"inject","z":"fe76f7928e585317","name":"empty","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":150,"y":2280,"wires":[["4b83793716b7210a"]]},{"id":"9124c2454fb2743b","type":"join","z":"fe76f7928e585317","name":"","mode":"custom","build":"object","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":true,"timeout":"","count":"2","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":550,"y":2300,"wires":[["5b3330da61b5b546"]]},{"id":"945d4e1fe79a8155","type":"change","z":"fe76f7928e585317","name":"true/false","rules":[{"t":"set","p":"payload","pt":"msg","to":"$$.payload != \"\"","tot":"jsonata"},{"t":"set","p":"topic","pt":"msg","to":"vehicle_check","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":360,"y":2340,"wires":[["9124c2454fb2743b"]]},{"id":"5b3330da61b5b546","type":"change","z":"fe76f7928e585317","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$not(false in $$.payload.*)","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":720,"y":2300,"wires":[["5f521f6e4526fbed"]]},{"id":"aab8d9bd798f5b09","type":"inject","z":"fe76f7928e585317","name":"not empty","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"not empty","payloadType":"str","x":140,"y":2340,"wires":[["945d4e1fe79a8155"]]},{"id":"5a7fdd326dc7cebb","type":"inject","z":"fe76f7928e585317","name":"empty","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"str","x":150,"y":2380,"wires":[["945d4e1fe79a8155"]]},{"id":"5f521f6e4526fbed","type":"debug","z":"fe76f7928e585317","name":"debug 9","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":760,"y":2360,"wires":[]}]

thank you everyone for wanting to help, but right now both solutions haven't worked after I tried.

I tried to check the two data in MySQL, if the data exists then true, if not then false.
if both data is there then the light is on. I am attaching all my programs

[
    {
        "id": "46af9c65977c5ac5",
        "type": "tab",
        "label": "Dispense",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "869f63da3c96ed47",
        "type": "inject",
        "z": "46af9c65977c5ac5",
        "name": "1s",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "1",
        "crontab": "",
        "once": true,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 890,
        "y": 1260,
        "wires": [
            [
                "033c5b2925f89c99"
            ]
        ]
    },
    {
        "id": "033c5b2925f89c99",
        "type": "simpletime",
        "z": "46af9c65977c5ac5",
        "name": "",
        "mydate": true,
        "myymd": true,
        "myyear": true,
        "mymonth": true,
        "mymonthn": true,
        "mydom": true,
        "mydoy": true,
        "myday": true,
        "myhourpm": true,
        "myhour": true,
        "mytime": true,
        "mytimes": true,
        "myminute": true,
        "myminutes": true,
        "mysecond": true,
        "mymillis": true,
        "myepoch": true,
        "myrawdate": true,
        "mypm": true,
        "x": 1070,
        "y": 1260,
        "wires": [
            [
                "690541599bda7a6b"
            ]
        ]
    },
    {
        "id": "690541599bda7a6b",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "mymillis",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1280,
        "y": 1260,
        "wires": [
            [
                "d5881bd159904eac"
            ]
        ]
    },
    {
        "id": "a8a10cc2.9d0ae",
        "type": "ui_template",
        "z": "46af9c65977c5ac5",
        "d": true,
        "group": "",
        "name": "",
        "order": 0,
        "width": 0,
        "height": 0,
        "format": "<style>\nbody.nr-dashboard-theme {\n    font-size: 50px !important;\n}\n.md-toolbar-tools h1 {\n    font-size: 50px !important;\n}\n</style>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": false,
        "templateScope": "global",
        "className": "",
        "x": 1660,
        "y": 140,
        "wires": [
            []
        ]
    },
    {
        "id": "eca62c1a.40bdf8",
        "type": "ui_template",
        "z": "46af9c65977c5ac5",
        "d": true,
        "group": "45c2b0fada35658c",
        "name": "CSS: ui-table",
        "order": 1,
        "width": 0,
        "height": 0,
        "format": "<style>\n\n  .tabulator{padding-left:2px;border:1px solid #000;background-color:#202529;font-size:17px}\n  \n  .tabulator .tabulator-header{border-bottom:0px solid #000;background-color:#202529}\n  .tabulator-col-content{background-color:#202529;height:37px}\n\n  .tabulator-row{min-height:31px;background-color:#181c1f}\n  .tabulator-row:nth-child(2n){background-color:#202529}\n\n  .tabulator-row .tabulator-cell{border-right:0px solid #888}\n  .tabulator .tabulator-header .tabulator-col{border-right:0px solid #aaa}\n\n</style>",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 1670,
        "y": 180,
        "wires": [
            []
        ]
    },
    {
        "id": "d365d02956b1c509",
        "type": "ui_template",
        "z": "46af9c65977c5ac5",
        "d": true,
        "group": "",
        "name": "top-bar logo",
        "order": 1,
        "width": 0,
        "height": 0,
        "format": "<style>\n    #top-bar-logo {\n    background-image: url(C:/Users/fauzi/.node-red/image/YPH-04.png);\n    background-size: contain;\n    background-repeat: no-repeat;\n    background-position: center;\n    height: 100%;\n    width: 100%;\n}\n</style>\n\n<script id=\"logo-script\" type=\"text/javascript\">\nfunction build(){\n    $(\"#top-bar-logo\").remove()\n    var logo = $('<div />').attr(\"id\",\"top-bar-logo\");\n    var topbar = $('.md-toolbar-tools');\n    topbar.append(logo)\n}\nfunction checkExistence(){\n    console.log($(\"#top-bar-logo\"))\n    if($(\"#top-bar-logo\").length > 0){\n        return\n    }\n    build()\n    setTimeout(checkExistence,100)\n}\n\nbuild()\nsetTimeout(checkExistence,100)\n</script>\n",
        "storeOutMessages": true,
        "fwdInMessages": true,
        "resendOnRefresh": true,
        "templateScope": "global",
        "className": "",
        "x": 1470,
        "y": 1220,
        "wires": [
            []
        ]
    },
    {
        "id": "63cc2f30dd00919c",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "No register",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 940,
        "y": 1140,
        "wires": [
            [
                "7bbad76d10e7bd10"
            ]
        ]
    },
    {
        "id": "7bbad76d10e7bd10",
        "type": "ui_toast",
        "z": "46af9c65977c5ac5",
        "position": "dialog",
        "displayTime": "3",
        "highlight": "",
        "sendall": true,
        "outputs": 1,
        "ok": "OK",
        "cancel": "",
        "raw": false,
        "className": "",
        "topic": "Error!",
        "name": "",
        "x": 990,
        "y": 1080,
        "wires": [
            []
        ]
    },
    {
        "id": "6c3631d25dd44018",
        "type": "catch",
        "z": "46af9c65977c5ac5",
        "name": "",
        "scope": [
            "3afebdb40bbf661f"
        ],
        "uncaught": false,
        "x": 750,
        "y": 1140,
        "wires": [
            [
                "587dde99b21ba42e",
                "63cc2f30dd00919c"
            ]
        ]
    },
    {
        "id": "587dde99b21ba42e",
        "type": "debug",
        "z": "46af9c65977c5ac5",
        "name": "debug 5",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "error.message",
        "targetType": "msg",
        "statusVal": "",
        "statusType": "auto",
        "x": 980,
        "y": 1200,
        "wires": []
    },
    {
        "id": "bbe003c1fcd78cb9",
        "type": "ui_text_input",
        "z": "46af9c65977c5ac5",
        "name": "vehicle_id",
        "label": "Key",
        "tooltip": "",
        "group": "5926a7ec1c8bca68",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "mode": "text",
        "delay": 300,
        "topic": "payload",
        "sendOnBlur": true,
        "className": "",
        "topicType": "msg",
        "x": 620,
        "y": 600,
        "wires": [
            [
                "d0e3c8c83cbc646b",
                "e9ac9898124acf17"
            ]
        ]
    },
    {
        "id": "d5881bd159904eac",
        "type": "ui_digital_display",
        "z": "46af9c65977c5ac5",
        "name": "",
        "group": "9c2005d7a47d91e9",
        "order": 1,
        "width": 6,
        "height": 3,
        "digits": 5,
        "decimals": "2",
        "x": 1480,
        "y": 1260,
        "wires": []
    },
    {
        "id": "dbded81ead5dabae",
        "type": "ui_text_input",
        "z": "46af9c65977c5ac5",
        "name": "driver_id",
        "label": "Key / Code *",
        "tooltip": "",
        "group": "3e8a11af575bd99c",
        "order": 1,
        "width": 0,
        "height": 0,
        "passthru": false,
        "mode": "text",
        "delay": 300,
        "topic": "topic",
        "sendOnBlur": true,
        "className": "",
        "topicType": "msg",
        "x": 620,
        "y": 400,
        "wires": [
            [
                "148a11ebf32e5ecb",
                "c63dd50c12e95f86"
            ]
        ]
    },
    {
        "id": "148a11ebf32e5ecb",
        "type": "function",
        "z": "46af9c65977c5ac5",
        "name": "check drivers",
        "func": "msg.topic = \"SELECT * FROM drivers WHERE driver_id='\" + msg.payload + \"';\";\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 810,
        "y": 400,
        "wires": [
            [
                "633d2e1dd08651ce"
            ]
        ]
    },
    {
        "id": "633d2e1dd08651ce",
        "type": "mysql",
        "z": "46af9c65977c5ac5",
        "mydb": "31ef07c343cafec2",
        "name": "drivers table",
        "x": 1050,
        "y": 400,
        "wires": [
            [
                "fe23ebf967cff990",
                "65999d5c3668e431"
            ]
        ]
    },
    {
        "id": "d7f93e6b37c4ee98",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "send failed message",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "your key is not registered!",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1460,
        "y": 440,
        "wires": [
            [
                "a16d73c5c97a3ebc"
            ]
        ]
    },
    {
        "id": "a16d73c5c97a3ebc",
        "type": "ui_toast",
        "z": "46af9c65977c5ac5",
        "position": "dialog",
        "displayTime": "3",
        "highlight": "",
        "sendall": true,
        "outputs": 1,
        "ok": "OK",
        "cancel": "",
        "raw": false,
        "className": "",
        "topic": "Error: Key registration",
        "name": "",
        "x": 1690,
        "y": 440,
        "wires": [
            [
                "0e2641ba749541a6"
            ]
        ]
    },
    {
        "id": "c63dd50c12e95f86",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "driver_id",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 830,
        "y": 460,
        "wires": [
            []
        ]
    },
    {
        "id": "013aa912d8563d25",
        "type": "link out",
        "z": "46af9c65977c5ac5",
        "name": "to clear",
        "mode": "link",
        "links": [
            "bb5e6814ac3c9885",
            "e6d2ada026c17ad8"
        ],
        "x": 2060,
        "y": 440,
        "wires": [],
        "l": true
    },
    {
        "id": "bb5e6814ac3c9885",
        "type": "link in",
        "z": "46af9c65977c5ac5",
        "name": "from clear",
        "links": [
            "013aa912d8563d25"
        ],
        "x": 440,
        "y": 400,
        "wires": [
            [
                "dbded81ead5dabae"
            ]
        ],
        "l": true
    },
    {
        "id": "0e2641ba749541a6",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "clear data",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1880,
        "y": 440,
        "wires": [
            [
                "013aa912d8563d25"
            ]
        ]
    },
    {
        "id": "d0e3c8c83cbc646b",
        "type": "function",
        "z": "46af9c65977c5ac5",
        "name": "check drivers",
        "func": "msg.topic = \"SELECT * FROM vehicles WHERE vehicle_id='\" + msg.payload + \"';\";\n\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 810,
        "y": 600,
        "wires": [
            [
                "a537d7486545c859"
            ]
        ]
    },
    {
        "id": "a537d7486545c859",
        "type": "mysql",
        "z": "46af9c65977c5ac5",
        "mydb": "31ef07c343cafec2",
        "name": "vehicles table",
        "x": 1060,
        "y": 600,
        "wires": [
            [
                "5cce97c399e78739",
                "7ef143da77cde04b"
            ]
        ]
    },
    {
        "id": "5cce97c399e78739",
        "type": "switch",
        "z": "46af9c65977c5ac5",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "nempty"
            },
            {
                "t": "empty"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1250,
        "y": 600,
        "wires": [
            [],
            [
                "fc5daa19e538282e"
            ]
        ]
    },
    {
        "id": "fc5daa19e538282e",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "send failed message",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "your key is not registered!",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1460,
        "y": 640,
        "wires": [
            [
                "de990773afe19696"
            ]
        ]
    },
    {
        "id": "e9ac9898124acf17",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "vehicle_id",
                "pt": "flow",
                "to": "payload",
                "tot": "msg"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 830,
        "y": 660,
        "wires": [
            []
        ]
    },
    {
        "id": "e274b0bfd4bc3c52",
        "type": "link out",
        "z": "46af9c65977c5ac5",
        "name": "to clear",
        "mode": "link",
        "links": [
            "92f099a14735f5f5",
            "e5a70d58744f2c47"
        ],
        "x": 2080,
        "y": 640,
        "wires": [],
        "l": true
    },
    {
        "id": "92f099a14735f5f5",
        "type": "link in",
        "z": "46af9c65977c5ac5",
        "name": "from clear",
        "links": [
            "e274b0bfd4bc3c52"
        ],
        "x": 440,
        "y": 600,
        "wires": [
            [
                "bbe003c1fcd78cb9"
            ]
        ],
        "l": true
    },
    {
        "id": "77cdf4aae53b687e",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "clear data",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1880,
        "y": 640,
        "wires": [
            [
                "e274b0bfd4bc3c52"
            ]
        ]
    },
    {
        "id": "600873210303735c",
        "type": "ui_template",
        "z": "46af9c65977c5ac5",
        "group": "3e8a11af575bd99c",
        "name": "Cancel",
        "order": 4,
        "width": 4,
        "height": 1,
        "format": "\n<md-button class=\"vibrate filled touched smallfont rounded\" style=\"background-color:#0094CE\" ng-click=\"send({payload: 'Cancel'})\"> \n    Cancel<br/>\n</md-button> \n\n",
        "storeOutMessages": true,
        "fwdInMessages": false,
        "resendOnRefresh": false,
        "templateScope": "local",
        "className": "",
        "x": 800,
        "y": 740,
        "wires": [
            [
                "d908d2c3e3d1c022"
            ]
        ]
    },
    {
        "id": "d908d2c3e3d1c022",
        "type": "link out",
        "z": "46af9c65977c5ac5",
        "name": "to clear all",
        "mode": "link",
        "links": [
            "bfa2d52e1a6c0d57",
            "648797d0a55fc31d"
        ],
        "x": 970,
        "y": 740,
        "wires": [],
        "l": true
    },
    {
        "id": "bfa2d52e1a6c0d57",
        "type": "link in",
        "z": "46af9c65977c5ac5",
        "name": "from clear all",
        "links": [
            "d908d2c3e3d1c022"
        ],
        "x": 1690,
        "y": 480,
        "wires": [
            [
                "0e2641ba749541a6"
            ]
        ],
        "l": true
    },
    {
        "id": "648797d0a55fc31d",
        "type": "link in",
        "z": "46af9c65977c5ac5",
        "name": "from clear all",
        "links": [
            "d908d2c3e3d1c022"
        ],
        "x": 1690,
        "y": 680,
        "wires": [
            [
                "77cdf4aae53b687e"
            ]
        ],
        "l": true
    },
    {
        "id": "de990773afe19696",
        "type": "ui_toast",
        "z": "46af9c65977c5ac5",
        "position": "dialog",
        "displayTime": "3",
        "highlight": "",
        "sendall": true,
        "outputs": 1,
        "ok": "OK",
        "cancel": "",
        "raw": false,
        "className": "",
        "topic": "Error: Key registration",
        "name": "",
        "x": 1690,
        "y": 640,
        "wires": [
            [
                "77cdf4aae53b687e"
            ]
        ]
    },
    {
        "id": "4ca2a42112bffdb6",
        "type": "ui_led",
        "z": "46af9c65977c5ac5",
        "order": 2,
        "group": "5926a7ec1c8bca68",
        "width": 0,
        "height": 0,
        "label": "",
        "labelPlacement": "left",
        "labelAlignment": "left",
        "colorForValue": [
            {
                "color": "#ff0000",
                "value": "false",
                "valueType": "bool"
            },
            {
                "color": "#008000",
                "value": "true",
                "valueType": "bool"
            }
        ],
        "allowColorForValueInMessage": false,
        "shape": "circle",
        "showGlow": true,
        "name": "",
        "x": 2050,
        "y": 580,
        "wires": []
    },
    {
        "id": "0015e288da51c85f",
        "type": "inject",
        "z": "46af9c65977c5ac5",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "table2",
        "payload": "false",
        "payloadType": "bool",
        "x": 1390,
        "y": 1040,
        "wires": [
            []
        ]
    },
    {
        "id": "fe23ebf967cff990",
        "type": "switch",
        "z": "46af9c65977c5ac5",
        "name": "",
        "property": "payload",
        "propertyType": "msg",
        "rules": [
            {
                "t": "nempty"
            },
            {
                "t": "empty"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 2,
        "x": 1250,
        "y": 400,
        "wires": [
            [],
            [
                "d7f93e6b37c4ee98"
            ]
        ]
    },
    {
        "id": "3a9ae8ae55fcce89",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "true",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "driver_check_true",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1410,
        "y": 360,
        "wires": [
            [
                "a3173db41f89d858"
            ]
        ]
    },
    {
        "id": "2ea4e2d383f2238c",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "false",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "driver_check_false",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1410,
        "y": 400,
        "wires": [
            [
                "a3173db41f89d858"
            ]
        ]
    },
    {
        "id": "9a96fa485efd39b8",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "true",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "vehicle_check_true",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1410,
        "y": 560,
        "wires": [
            []
        ]
    },
    {
        "id": "d16efd8d4b33d498",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "false",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "false",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "vehicle_check_false",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1410,
        "y": 600,
        "wires": [
            []
        ]
    },
    {
        "id": "a3173db41f89d858",
        "type": "debug",
        "z": "46af9c65977c5ac5",
        "name": "debug 11",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1660,
        "y": 360,
        "wires": []
    },
    {
        "id": "2566013ead2f6f5f",
        "type": "BooleanLogicUltimate",
        "z": "46af9c65977c5ac5",
        "name": "",
        "payloadPropName": "payload",
        "filtertrue": "both",
        "persist": true,
        "sInitializeWith": "WaitForPayload",
        "triggertopic": "trigger",
        "outputtriggeredby": "all",
        "inputCount": 2,
        "topic": "result",
        "restrictinputevaluation": false,
        "delayEvaluation": 0,
        "x": 1670,
        "y": 800,
        "wires": [
            [
                "fcae1fcc26b45b8f",
                "4ca2a42112bffdb6"
            ],
            [],
            []
        ]
    },
    {
        "id": "fcae1fcc26b45b8f",
        "type": "debug",
        "z": "46af9c65977c5ac5",
        "name": "debug 14",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1840,
        "y": 800,
        "wires": []
    },
    {
        "id": "7ef143da77cde04b",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "^.+$",
                "fromt": "re",
                "to": "true",
                "tot": "bool"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "^$",
                "fromt": "re",
                "to": "false",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "vehicle_check",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1480,
        "y": 720,
        "wires": [
            [
                "2566013ead2f6f5f"
            ]
        ]
    },
    {
        "id": "65999d5c3668e431",
        "type": "change",
        "z": "46af9c65977c5ac5",
        "name": "",
        "rules": [
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "^.+$",
                "fromt": "re",
                "to": "true",
                "tot": "bool"
            },
            {
                "t": "change",
                "p": "payload",
                "pt": "msg",
                "from": "^$",
                "fromt": "re",
                "to": "false",
                "tot": "bool"
            },
            {
                "t": "set",
                "p": "topic",
                "pt": "msg",
                "to": "driver_check",
                "tot": "str"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 1600,
        "y": 540,
        "wires": [
            [
                "2566013ead2f6f5f"
            ]
        ]
    },
    {
        "id": "45c2b0fada35658c",
        "type": "ui_group",
        "name": "Transactions",
        "tab": "e11aa43fd19026d6",
        "order": 1,
        "disp": true,
        "width": "21",
        "collapse": false,
        "className": ""
    },
    {
        "id": "5926a7ec1c8bca68",
        "type": "ui_group",
        "name": "Enter Vehicles Key",
        "tab": "8de2e50a0e16ee3b",
        "order": 2,
        "disp": true,
        "width": 4,
        "collapse": false,
        "className": ""
    },
    {
        "id": "9c2005d7a47d91e9",
        "type": "ui_group",
        "name": "Flowmeter",
        "tab": "8de2e50a0e16ee3b",
        "order": 3,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "3e8a11af575bd99c",
        "type": "ui_group",
        "z": "46af9c65977c5ac5",
        "name": "Enter Drivers Key",
        "tab": "8de2e50a0e16ee3b",
        "order": 1,
        "disp": true,
        "width": 4,
        "collapse": false,
        "className": ""
    },
    {
        "id": "31ef07c343cafec2",
        "type": "MySQLdatabase",
        "name": "",
        "host": "127.0.0.1",
        "port": "3306",
        "db": "mydatabase",
        "tz": "",
        "charset": "UTF8"
    },
    {
        "id": "e11aa43fd19026d6",
        "type": "ui_tab",
        "name": "Transactions",
        "icon": "assignment_turned_in",
        "order": 2,
        "disabled": false,
        "hidden": false
    },
    {
        "id": "8de2e50a0e16ee3b",
        "type": "ui_tab",
        "name": "Dispense",
        "icon": "local_gas_station",
        "order": 1,
        "disabled": false,
        "hidden": false
    }
]

Put a debug node after each database node and after each "change:3rules" node, set to show the complete message.
What do they show 1) when both driver and vehicle id are valid and 2) when one of them is invalid?
What does the status message under the boolean logic node say in each case?

Instead of putting this logic in node-red, I would write a query that outputs the value you need (ie. put the logic in mysql, not node-red)