UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Z2KZPCF+vHMy4RmENytMxzuaJ5Tk4Ixtu+H3QrrhC7I='
WHERE
key_id = 'd168fa18fc87db53967c7957bccfe2693ea99c009cd9bf3292371f4f65826cad'
AND (
token = 'Z2KZPCF+vHMy4RmENytMxzuaJ5Tk4Ixtu+H3QrrhC7I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)